home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 34.zip / BS1 part 34 / FredFish PD 316.adf / IntuiSup / Applications / SmallBenchSrc / smallbench.c < prev   
C/C++ Source or Header  |  1990-02-06  |  2KB  |  73 lines

  1.  
  2. #include <intuition/intuisup.h>
  3. #include <intuition/intuitionbase.h>
  4. #include <libraries/dos.h>
  5.  
  6. #ifndef DEBUG
  7. #include <proto/exec.h>
  8. #include <proto/intuition.h>
  9. #endif
  10.  
  11. extern struct WBStartup *WBenchMsg;
  12.  
  13. struct   IntuitionBase  *IntuitionBase;
  14. struct   GfxBase        *GfxBase;
  15. struct   IconBase       *IconBase;
  16. struct   Library        *iSupBase;
  17. struct   FileIOSupport  *fileio;
  18. struct   Device         *ConsoleDevice;
  19.  
  20. UBYTE Error[2][30] =
  21.    {
  22.    "Unknown file type",
  23.    "Can't acces that file"
  24.    };
  25.  
  26. VOID main(argc, argv)
  27. UBYTE argc, **argv;
  28. {
  29.    BYTE     filetype;
  30.    UBYTE    name[80];
  31.    struct   FileIOSupport *fileio;
  32.    struct   Screen        wbscreen;
  33.  
  34.    IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 0);
  35.    GfxBase       = (struct GfxBase *)OpenLibrary("graphics.library", 0);
  36.    IconBase      = (struct IconBase *)OpenLibrary("icon.library", 0);
  37.    iSupBase      = (struct iSupBase *)OpenLibrary("isup.library", 0);
  38.    if ( !IntuitionBase || !GfxBase || !IconBase || !iSupBase) goto MAIN_DONE;
  39.  
  40.    if (argc)
  41.       switch(ParseCLIArgs(argc, argv))
  42.             {
  43.             case 2:
  44.                printf("Invalid arguments. Enter Smallbench -h for help\n");
  45.             case 1:
  46.                exit(0);
  47.             }
  48.    else ParseWBArgs(WBenchMsg);
  49.  
  50.  
  51.    if (  !GetScreenData(&wbscreen, sizeof(struct Screen), WBENCHSCREEN, NULL)
  52.       || !(fileio = GetFileIOSupport(NULL)) ) goto MAIN_DONE;
  53.  
  54.    fileio->ReqTitle    = (UBYTE *)"SmallBench v1.1, by -ghg-";
  55.    fileio->ReqPattern  = "*";
  56.    fileio->Flags      |= FR_AUTO_CLOSE_OFF | FR_REQUESTER_OFF;
  57.    while (GetFileIOName(fileio, NULL, wbscreen.Width-FR_WIDTH(fileio)-10, 15))
  58.          {
  59.          BuildFileIOPathname(fileio, name);
  60.          if ( (filetype = FileType(fileio->FRWindow, name))>=0 ) DisplayFile(fileio->FRWindow, name, filetype);
  61.          else AutoSmartRequest(fileio->FRWindow, 1, Error[-filetype-1], 0, "Ok", NULL, NULL, NULL);
  62.          }
  63.  
  64.  
  65.    MAIN_DONE:
  66.       if (fileio)           ReleaseFileIO(fileio);
  67.       if (IntuitionBase)    CloseLibrary(IntuitionBase);
  68.       if (GfxBase)          CloseLibrary(GfxBase);
  69.       if (IconBase)         CloseLibrary(IconBase);
  70.       if (iSupBase)         CloseLibrary(iSupBase);
  71. }
  72.  
  73.